This notebook will contain the loading component of the Kimberley data loading procedure.
In preparation, the original data will have been
This workbook will parse the CSV versions and upload the data to BioSys via its API.
Workhorse functions will be located in a separate file helpers.py
.
Copy secret_template.py
to secret.py
and modify to contain your CKAN instance and API key.
In [1]:
import ckanapi
import csv
import json
import requests
from secret import CKAN, LCI, BIOSYS
import helpers as h
ck
will be a ckanapi instance that carries your CKAN account's write permissions, and is able to read all public datasets.
In [2]:
ck = ckanapi.RemoteCKAN(CKAN["dpaw-internal"]["url"], apikey=CKAN["dpaw-internal"]["key"])
A CKAN resource's URL changes if the file resource changes, but the resource ID will be persistent.
The config dict LCI
lists resource names (from original data worksheet names) against their CKAN resource ID.
A helper function get_data
reads all configured datasets (CSV resources in CKAN).
In [10]:
data = h.get_data(ck, LCI)
data
Out[10]:
In [11]:
[r for r in data["sites"]][0]
Out[11]:
In [ ]: